home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C ++ / Applications / FlyThrough 1.1.2 / src / Source / QD3D General Tools / CDrawContextMaker.cp < prev    next >
Encoding:
Text File  |  1996-07-11  |  1.3 KB  |  49 lines  |  [TEXT/CWIE]

  1. //
  2. //    CDrawContextMaker.cp
  3. //
  4.  
  5. #include "CDrawContextMaker.h"
  6.  
  7. CDrawContextMaker::CDrawContextMaker( CGrafPtr inWindow, Rect &inFrame )
  8. {
  9.     // (Perhaps we can init the TQ3DrawContextData struct from a resource.)
  10.     // (The window part has to be done by hand.)
  11.     Assert_( inWindow != nil );
  12.     
  13.     // data is a reference into the TQ3MacDrawContextData (easier to type)
  14.     TQ3DrawContextData    &    data = mData.drawContextData;
  15.  
  16.     //    Fill in draw context data.
  17.     data.clearImageMethod = kQ3ClearMethodWithColor;
  18.     ::Q3ColorARGB_Set( & data.clearImageColor, 1.0, 0.0, 0.0, 0.0 );
  19.     
  20.     // the area of the pane
  21.     ::Q3Point2D_Set( &data.pane.min, inFrame.left, inFrame.top );
  22.     ::Q3Point2D_Set( &data.pane.max, inFrame.right, inFrame.bottom );
  23.     data.paneState = kQ3True;    // so the area data will be used
  24.     data.maskState = kQ3False;
  25.     data.doubleBufferState = kQ3True;
  26.  
  27.     // this is the window associated with the view
  28.     mData.window = inWindow;
  29.     mData.library = kQ3Mac2DLibraryNone;
  30.     mData.viewPort = nil;
  31.     mData.grafPort = nil;
  32. }
  33.  
  34. void CDrawContextMaker::SetClearImageColor(TQ3ColorARGB &inColor)
  35. {
  36.     Q3Forget( mObject );    // if we changed the color, dispose of any old object
  37.     mData.drawContextData.clearImageColor = inColor;
  38. }
  39.  
  40. void CDrawContextMaker::Make()
  41. {
  42.     TQ3DrawContextObject    theContext ;
  43.  
  44.     theContext = ::Q3MacDrawContext_New( &mData ) ;
  45.     ThrowIfNil_(theContext);
  46.     
  47.     mObject = theContext;
  48. }
  49.